<?php
class TourController extends Zend_Controller_Action
{
	private $_db = null;
	
	public function init(){
		$registry = Zend_Registry::getInstance();
		$this->_db = $registry->get('db');
	}
	
	public function indexAction()
	{
		
	}
	
	public function viewAction()
	{
            $breadcrumb= Array ("0" =>Array("title" => "Home", "url" => "/index/" ) ,"1" => Array("title" =>"Tours","url"=>"" ) );
            $this->view->breadcrumb()->set($breadcrumb);
		$this->_helper->layout->setLayout('layout');
		Zend_Loader::loadFile("../application/default/models/Tour.php");
		Zend_Loader::loadFile("../application/default/models/Aboutcountry.php");
		
		$sess = new Zend_Session_Namespace('locale');
        $curr_lang = $sess->current_lang;
        if($curr_lang != '')
        {
            $lang = $curr_lang;
        } else {
    	    $lang = 'en';
	    }
		
		$model_tour = new Tour();
		$request = $this->getRequest();
		$tour_arr = $model_tour->getTourDetails();
                $itemperpage = $config->application->itemperpage;

                $page=$this->_getParam('page',1);
                $paginator = Zend_Paginator::factory($tour_arr);
                $paginator->setItemCountPerPage($itemperpage);
                $paginator->setCurrentPageNumber($page);

                $this->view->paginator=$paginator;
		$this->view->tour_arr = $tour_arr;
		$this->view->lang = $lang;
	}
	
	public function detailsAction()
	{
		$breadcrumb= Array ("0" =>Array("title" => "Tours", "url" => "/tour/view/" ) ,"1" => Array("title" =>"Tour Details","url"=>"" ) );
                $this->view->breadcrumb()->set($breadcrumb);
                $this->_helper->layout->setLayout('layout');
		Zend_Loader::loadFile("../application/default/models/Tour.php");
		Zend_Loader::loadFile("../application/default/models/Aboutcountry.php");
                $sess = new Zend_Session_Namespace('locale');
                $curr_lang = $sess->current_lang;
                if($curr_lang != '')
                {
                    $lang = $curr_lang;
                } else {
                    $lang = 'en';
                }
		$model_tour = new Tour();
		$request = $this->getRequest();
		$tour_id = $request->getParam('tour_id', 0);
		$tour_arr = $model_tour->getTourDetailsById($tour_id);
		$this->view->tour_arr = $tour_arr;
		$this->view->lang = $lang;
		
	}
}	
?>	